﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using QLBV.Models;

namespace QLBV.Controllers
{
    public class NewController : Controller
    {
        //
        // GET: /New/
        QLBVContext db = new QLBVContext();
        public ActionResult ListNew()
        {
            IList<News> Tintuc;
             Tintuc = (from tt in db.News
                           orderby tt.ID descending
                           select tt).ToList();

            return View(Tintuc);      
        }
        public ActionResult ContentNew(int ID)
        {
            var Chitiet = (from tt in db.News
                           where tt.View == ID
                           select tt).FirstOrDefault();

            return View(Chitiet);

            //var nd = db.News.Where(n => n.ID == ID).FirstOrDefault();
            //return View(nd);

        }
       
    }
}
